import { defaultconfig } from "./defaultconfig";

const config = (() => {
    const config = defaultconfig;
    if (!process.env.PRERENDER) {
        const searchobj = Object.fromEntries(
            new URL(location.href).searchParams
        );
        // console.log("search", searchobj);

        Object.keys(config).forEach((key) => {
            if (Reflect.ownKeys(defaultconfig).includes(key)) {
                let value = searchobj[key];
                value && Reflect.set(config, key, value);
            }
        });
        config.baseurl = String(new URL(config.baseurl, location.href));
    }
    return config;
})();
console.log(config);
export default config;
